#include "inc.h"
#include "device.h"
#include "graphic.h"
#include "font.h"
#include "key4x4.h"

void Startup()
{
	int i;
	int x=0, y=0;
	Clear(0x0000);
	for(i=0, x=0, y=0; i<80; ++i)
	{
		x++;
		DrawRect(160-x, 120-y, 160+x, 120+y, 0xffff);
		y++;
		DrawRect(160-x, 120-y, 160+x, 120+y, 0xffff);
		x++;
		DrawRect(160-x, 120-y, 160+x, 120+y, 0xffff);
		y++;
		DrawRect(160-x, 120-y, 160+x, 120+y, 0xffff);
		x++;
		DrawRect(160-x, 120-y, 160+x, 120+y, 0xffff);
		y++;
		DrawRect(160-x, 120-y, 160+x, 120+y, 0xffff);
		x++;
		DrawRect(160-x, 120-y, 160+x, 120+y, 0xffff);
	}
	Clear(0xffff);
	Delay(1000);
}

void main()
{
	uchar select, key;
	char show = '?';
	Init_Device();
	LCD_Init();
	Startup();
    while(1)
    {
		DrawString(20, 20, 0x0, "Select a game from above list.");
		DrawRect(20, 40, 299, 219, 0x0);
		Delay(1000);
		key = Key_Check();
        switch(key)
        {
            case KEY_0:
                show = '0';
		FillRect(0, 0, 80, 16, key);
		DrawAChar(0, 0, 0x0, show);			
		Delay(1000); 
	}
}
/*
void Tetris()
{
}*/